/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gameheart.client.sprite;

import gameheart.client.sprite.CardSprite;

/**
 *
 * @author win7
 */
public class HorizonalMoveState extends MoveState {

    @Override
    public void updatePosition(CardSprite card, double a, double b, double c, int speed) {
        if (isMoving(card, a, b, c)) {
            int directedSpeed = speed * (card._destX - card._srcX) / Math.abs(card._destX - card._srcX);
            double x = card.getX() + directedSpeed;
            double y = -(a * x + c) / b;
            card.setX((int) x);
            card.setY((int) y);
        }
    }
}
